<template>
	<view>
		<project v-if="PageCur=='project'"></project>
		<community v-if="PageCur=='community'"></community>
		<quality v-if="PageCur=='quality'"></quality>
		<enterprise v-if="PageCur=='enterprise'"></enterprise>
		<problemMain v-if="PageCur =='problemMain'"></problemMain>
		<my v-if="PageCur=='my'"></my>
		
		
		<view class="cu-bar tabbar bg-black shadow foot">
			<view class="action" @click="NavChange" data-cur="problemMain">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/plugin' + [PageCur=='plugin'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='problemMain'?'text-green':'text-gray'">预验收</view>
			</view>
			
			<view class="action" @click="NavChange" data-cur="quality">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/basics' + [PageCur=='basics'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='quality'?'text-green':'text-gray'">质量评估</view>
			</view>
			<view class="action" @click="NavChange" data-cur="project">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/project' + [PageCur=='project'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='project'?'text-green':'text-gray'">排水达标</view>
			</view>
			<view class="action" @click="NavChange" data-cur="enterprise">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/enterprise' + [PageCur == 'enterprise'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='enterprise'?'text-green':'text-gray'">专家</view>
			</view>
			<view class="action" @click="NavChange" data-cur="my">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/about' + [PageCur == 'my'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='my'?'text-green':'text-gray'">我的</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState } from 'vuex';
	export default {
		computed: {
			...mapState(['hasLogin','userInfo'])
		},
		data() {
		return {
			  filterData:[
			                    [{ text: '全部状态', value: '' }, { text: '状态1', value: 1 }, { text: '状态2', value: 2 }, { text: '状态3', value: 3 }],
			                    [{ text: '全部类型', value: '' }, { text: '类型1', value: 1 }, { text: '类型2', value: 2 }, { text: '类型3', value: 3 }]
			                ],
			    defaultIndex:[0,0],
				PageCur: 'problemMain'
			}
		},
		mounted() {
			// 初始化加载
			// console.log(this.hasLogin)
			if( !this.hasLogin){
				// 如果没有登录，则跳转到登录页面
				uni.navigateTo({
					url:"../login/login"
				})
			}
		},
		methods: {
			showModal(e) {
				this.modalName = e.currentTarget.dataset.target
			},
			hideModal(e) {
				this.modalName = null
			},
			 onSelected(res){
				console.log(res)
			},
			dateChange(d){
			   uni.showToast({
				   icon:'none',
				   title:d
			   })
			},
			NavChange: function(e) {
				
				console.log(this.hasLogin)
				if( !this.hasLogin){
					// 如果没有登录，则跳转到登录页面
					uni.navigateTo({
						url:"../login/login"
					})
				}
				
				this.PageCur = e.currentTarget.dataset.cur
			},
		}
	}
</script>

<style>

</style>
